<?php

	if($_REQUEST["curr"])
	{
		require 'include/library.inc.php';
		$_SESSION["currency"] = $_REQUEST["curr"];	
		
		if($_REQUEST["curr"] == 'USD')
		{
			
			$_SESSION["currency_value"] = 1;
			$_SESSION["curr_sim"] = '&#36;';
			
		} else {
			
			$url = file_get_contents("https://rate-exchange.appspot.com/currency?from=USD&to=".$_REQUEST["curr"]);
			$start_url = explode(",", $url);
			$_SESSION["currency_value"] = substr($start_url[1],9,-1);
			
			if($_REQUEST["curr"] == 'EUR') $_SESSION["curr_sim"] = '&euro;';
			if($_REQUEST["curr"] == 'GBP') $_SESSION["curr_sim"] = '&pound;';
			
		}
						
	}

?>